package org.fanjr.simplify.rest;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Used to annotate the control layer that needs to be registered, this
 * annotation overwrites @RestInterface
 * 
 * @author fanjr@vip.qq.com
 * @since 20190222 10:29:28
 */
@Retention(RUNTIME)
@Target(TYPE)
@RestController
@RequestMapping
@Documented
public @interface Rest {

	/**
	 * The default is to use beanName as the path, but use this option if you don't
	 * want to use beanName as the root path
	 */
	String path() default "";

	/**
	 * You can specify that Spring's beanName also exists as the HTTP root of the
	 * exposed service, which you fill in if you need to define Spring's beanName
	 */
	@AliasFor(value = "value", annotation = RestController.class)
	String value() default "";

	/**
	 * You can just put @RestInterface on the interface! If you use this option, you
	 * will only expose the method on the interface, mainly when you can't add
	 * annotations on the interface but you need to use the interface as a guide to
	 * register the service.
	 */
	Class<?>[] inter() default {};
}
